﻿@{
    ViewBag.Title = "ReportEducationIndex";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
    $(function () {
        gridList();
    })
    function gridList() {
        $('#gridList').datagrid({
            url: '/Gas/Apply/GetReportDataJsonByEducation',
            toolbar: '#toolbar',
            autoRowHeight: false,
            nowrap: true,
            singleSelect: true,
            rownumbers: true,
            method: 'get',
            pagination: false,
            pageSize: 20,
            sortName: 'SortId',
            sortOrder: 'asc',
            columns: [[
                { field: 'F_Id', hidden: true },
                {
                    field: 'SchoolId', title: '学校', width: 150, align: 'center',
                    formatter: function (cellvalue) {
                        return top.clients.schoolItems[cellvalue] == undefined ? "" : top.clients.schoolItems[cellvalue].schoolName
                    }
                },
                {
                    field: 'classOne', title: '一年级', width: 120, align: 'center',
                    styler: function (value, row, index) {
                        if ((row.isRent == 1) && parseInt(value) > 0) {
                            return 'background-color:lightgreen;';
                        }
                        if ((row.isRent == 0) && parseInt(value) > 0) {
                            return 'background-color:khaki;';
                        }
                        if ((row.isRent == 0) && parseInt(value) <= 0) {
                            return 'background-color:#FF0000;';
                        }
                        return 'background-color:grey;';
                    }
                },
                {
                    field: 'classTwo', title: '二年级', width: 120, align: 'center',
                    styler: function (value, row, index) {
                        if ((row.isRent == 1) && parseInt(value) > 0) {
                            return 'background-color:lightgreen;';
                        }
                        if ((row.isRent == 0) && parseInt(value) > 0) {
                            return 'background-color:khaki;';
                        }
                        if ((row.isRent == 0) && parseInt(value) <= 0) {
                            return 'background-color:#FF0000;';
                        }
                        return 'background-color:grey;';
                    }
                },
                {
                    field: 'classThree', title: '三年级', width: 120, align: 'center',
                    styler: function (value, row, index) {
                        if ((row.isRent == 1) && parseInt(value) > 0) {
                            return 'background-color:lightgreen;';
                        }
                        if ((row.isRent == 0) && parseInt(value) > 0) {
                            return 'background-color:khaki;';
                        }
                        if ((row.isRent == 0) && parseInt(value) <= 0) {
                            return 'background-color:#FF0000;';
                        }
                        return 'background-color:grey;';
                    }
                },
                {
                    field: 'classFour', title: '四年级', width: 120, align: 'center',
                    styler: function (value, row, index) {
                        if (2 == row.SchoolType) {
                            return 'background-color:white;';
                        }
                        if ((row.isRent == 1) && parseInt(value) > 0) {
                            return 'background-color:lightgreen;';
                        }
                        if ((row.isRent == 0) && parseInt(value) > 0) {
                            return 'background-color:khaki;';
                        }
                        if ((row.isRent == 0) && parseInt(value) <= 0) {
                            return 'background-color:#FF0000;';
                        }
                        return 'background-color:grey;';
                    }
                },
                {
                    field: 'classFive', title: '五年级', width: 120, align: 'center',
                    styler: function (value, row, index) {
                        if (2 == row.SchoolType) {
                            return 'background-color:white;';
                        }
                        if ((row.isRent == 1) && parseInt(value) > 0) {
                            return 'background-color:lightgreen;';
                        }
                        if ((row.isRent == 0) && parseInt(value) > 0) {
                            return 'background-color:khaki;';
                        }
                        if ((row.isRent == 0) && parseInt(value) <= 0) {
                            return 'background-color:#FF0000;';
                        }
                        return 'background-color:grey;';
                    }
                },
            ]],
            onLoadSuccess: function (data) {
                if ("none" == $("#swichId").val()) {
                    for (var i = 0; i < data.total; i++) {
                        $("#gridList_datagrid-row-r2-2-" + i + " .gridList_datagrid-cell-c2-classOne").text("");
                        $("#gridList_datagrid-row-r2-2-" + i + " .gridList_datagrid-cell-c2-classTwo").text("");
                        $("#gridList_datagrid-row-r2-2-" + i + " .gridList_datagrid-cell-c2-classThree").text("");
                        $("#gridList_datagrid-row-r2-2-" + i + " .gridList_datagrid-cell-c2-classFour").text("");
                        $("#gridList_datagrid-row-r2-2-" + i + " .gridList_datagrid-cell-c2-classFive").text("");
                    };
                }
            },
        });

        $("#btn_search").click(function () {
            $('#gridList').datagrid('load');
        });
    }
</script>
<div><input type="hidden" name="swichId" id="swichId" value="@ViewBag.switchDiv" /></div>
<div id="stuArea" style="width:100%;padding-right:50px;font-size:initial;color:red">
    <h3>说明</h3>
    <div class="content-area">
        绿色表示该校年级有空余学位，填报转入校志愿时有房类和租房类都可选择；<br>
        黄色表示该校年级有空余学位，填报转入校志愿时有房类可选择，租房类不可选择；<br>
        红色表示该校年级目前无学位（如果目前要转入的家长请勿填写），不可办理转入，但有房类可以填报转学信息，如有转出，按转学信息填报先后顺序给予办理转入；<br>
        灰色表示该校年级目前无学位（如果目前要转入的家长请勿填写），有房和租房类都可以填报个人转学信息，如有转出， 按转学信息填报先后顺序给予办理转入。<br>
    </div>
</div>
<div class="easyui-layout" style="height:600px!important">
    <table id="gridList" class="easyui-datagrid" style="width:100%;min-height:600px;height:100%;"></table>
</div>
